package com.haruhinav.controller;

import com.haruhinav.entity.Address;
import com.haruhinav.entity.AddressType;
import com.haruhinav.entity.PicApi;
import com.haruhinav.entity.extend.AddressEX;
import com.haruhinav.service.AddressService;
import com.haruhinav.service.PicApiService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/api/address")
public class AddressController {
    @Autowired
    private AddressService addressService;
    @Resource
    private PicApiService picApiService;
    //    所有地址 一对一 暂时不需要
//    @RequestMapping(value = "/e/all",method = RequestMethod.GET)
//    public List<Address> getAllAddress(AddressEX addressEX){
//
//        return addressService.getAllAddress(addressEX);
//    }



//    所有地址 一对多
    @RequestMapping(value = "/e/all-bytype",method = RequestMethod.GET)
    public List<AddressType> getAllAddressByType(String... s){
        return addressService.getAllAddressByType();
    }
    //    所有地址 一对多 v2
    @RequestMapping(value = "/e/all-bytype/v2",method = RequestMethod.GET)
    public List<AddressType> getAllAddressByTypeV2(){
        return addressService.getAllAddressByTypeV2();
    }
//    所有随机图片接口（也算地址吧，主要是懒得再新建controller）
    @RequestMapping(value = "/e/all-picapi",method = RequestMethod.GET)
    public Map<String,Object> getAllPicApi(){
        return picApiService.getAllPicApi();
    }

}
